﻿//----------------------------------------------------------------
// Desc: 区域
// Edit: ShowLong, http://blog.csdn.net/showlong
//
// Date Created: 2010-06-30
//
// Update Date : 
//
// Copyright (c) Fuel4D (http://www.fuel4d.com), All rights reserved.
//
//----------------------------------------------------------------
#pragma once


#pragma pack(push, 1)
struct FVERSION_INFO
{
    FDECLARE_STRUCT(FVERSION_INFO);

    int nMajor;
    int nMinor;
    int nBuild1;
    int nBuild2;
    FMD5_OBJECT nFulMD5;
    FMD5_OBJECT nAppMD5;

    FVERSION_INFO()
        :nMajor(0)
        ,nMinor(0)
        ,nBuild1(0)
        ,nBuild2(0)
    {
    }
    FINLINE int GetBuild() const
    {
        return nBuild1 * 10000 + nBuild2;
    }
    FINLINE void SetBuild(int vcode)
    {
        nBuild1 = vcode / 10000;
        nBuild2 = vcode % 10000;
    }
    FINLINE bool operator < (const FVERSION_INFO& rr) const
    {
        if (nMajor > rr.nMajor)
            return false;
        if (nMinor > rr.nMinor)
            return false;
        if (nBuild1 > rr.nBuild1)
            return false;
        if (nBuild2 > rr.nBuild2)
            return false;
        // 补丁包MD5不需要比较
        return FMemcmp(nFulMD5.digest, rr.nFulMD5.digest, sizeof(nFulMD5.digest)) > 0;
    }
    FINLINE bool operator == (const FVERSION_INFO& rr) const
    {
        return nMajor == rr.nMajor && nMinor == rr.nMinor && nBuild1 == rr.nBuild1 && nBuild2 == rr.nBuild2;
    }
    FINLINE FVERSION_INFO& operator = (FVERSION_INFO &rr)
    {
        nMajor = rr.nMajor;
        nMinor = rr.nMinor;
        nBuild1 = rr.nBuild1;
        nBuild2 = rr.nBuild2;
        nFulMD5 = rr.nFulMD5;
        nAppMD5 = rr.nAppMD5;
        return *this;
    }
};
#pragma pack(pop)


typedef FVector< FVERSION_INFO >        FV_VERSION;
typedef FVector< FVERSION_INFO* >       FV_PVERSION;